package com.yidu.BusinessData.controller;


import com.yidu.BusinessData.entity.CashAccrued;
import com.yidu.BusinessData.service.CashAccruedService;
import com.yidu.CashManagement.entity.FundsAllot;
import com.yidu.CashManagement.util.CreateId;
import com.yidu.GlobalManagement.log.OperLog;
import com.yidu.GlobalManagement.log.util.OperationType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 周楠櫻木
 * @version 1.0
 * @date 2022/12/11
 */
@RestController
public class CashAccruedController {
    @Autowired
    private CashAccruedService cashAccruedService;

    /**
     * 查询，分页，拼接查询
     * @param page 单前页
     * @param row 显示页
     * @param businessTime 业务时间
     * @param businessType 业务类型
     * @return
     */
    @RequestMapping("/selectCashAccrued")
    public Map selectCashAccrued(int page, int row, String businessTime, @RequestParam(defaultValue = "-1") int businessType) {
        return cashAccruedService.selectCashAccrued(page, row, businessTime, businessType);
    }

    /**
     * 新增
     * @param cashAccrued 现金应收应付
     * @return
     */
    @RequestMapping("/addCashAccrued")
    public int addCashAccrued(CashAccrued cashAccrued) {
        return cashAccruedService.addCashAccrued(cashAccrued);
    }

    /**
     * 删除
     * @param myArr 数组
     */
    @RequestMapping("/deleteCashAccrued")
    public void deleteExchangeRate(String myArr) {
        cashAccruedService.deleteCashAccrued(myArr);
    }

    /**
     * 修改
     * @param cashAccrued 现金应收应付
     * @return
     */
    @RequestMapping("/updateCashAccrued")
    public String updateCashAccrued(CashAccrued cashAccrued) {
        System.out.println(cashAccrued.toString());
        return cashAccruedService.updateCashAccrued(cashAccrued);
    }

    /**
     * 两费删除
     * @param cashAccrued
     * @return
     */
    @RequestMapping("/deleteCashAccrueds")
    public int deleteCashAccrueds(CashAccrued cashAccrued){
        int i =  cashAccruedService.deleteCashAccrueds(cashAccrued);
        return i;
    }

    /**
     * 两费新增
     * @param cashAccruedId
     * @return
     */
    @RequestMapping("/selectCashAccrueds")
    public int selectCashAccrueds(String cashAccruedId){
        return cashAccruedService.selectCashAccrueds(cashAccruedId);
    }

}
